#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
const int N=510;
vector<int> g[N];

void solve()
{
	int n,q;
	cin>>n>>q;
	for(int i=1;i<n;i++)
	{
		cout<<i<<' '<<i+1<<endl;
	}
	int pos=n-1;
	while(q--)
	{
		int d;
		cin>>d;
		int des=n-d;
		if(pos!=n-d)
		{
			cout<<n<<' '<<pos<<' '<<des<<endl;
			pos=des;
		}
		else
		{
			cout<<"-1 -1 -1"<<endl;
		}
	}
}
int main()
{
	IOS;
	int T=1;
	cin>>T;

	while(T--)
	{
		solve();
	}

	return 0;
}

